#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    if(argc < 2)
    {
        fprintf(stderr, "Usages:%s <file>\n", argv[0]);
        exit(1);
    }

    FILE *fp = fopen(argv[1], "r");
    if(fp == NULL)
    {
        perror("fopen()");
        exit(1);
    }

    char *lineptr = NULL;
    size_t n = 0;
    while(1)
    {
        if(getline(&lineptr, &n, fp) < 0)
        {
            break;
        }
        printf("%s\n", lineptr);
    }

    fclose(fp);

    exit(0);
}
